import 'package:flutter/material.dart';
import 'package:flutter_douban/config/app_colors.dart';
import 'package:flutter_douban/main_page/store/page/store_shop_page.dart';
import 'package:flutter_douban/model/store_category_model.dart';
import 'package:flutter_douban/main_page/store/provider/store_count_model.dart';
import 'package:provider/provider.dart';

class ProductDetailBottowView extends StatefulWidget {
  final StoreCategoryModel model;
  const ProductDetailBottowView({Key? key,required this.model}) : super(key: key);

  @override
  _ProductDetailBottowViewState createState() => _ProductDetailBottowViewState();
}

class _ProductDetailBottowViewState extends State<ProductDetailBottowView> {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      width: MediaQuery.of(context).size.width,
      padding: EdgeInsets.only(left: 0,right: 10),
      height: 60,
      child: Row(
        children: [

          Container(
            width: MediaQuery.of(context).size.width/3/2+15,
            height: 40,
            child: Column(
              children: [
                Image.asset(
                  'assets/images/common/product_conversation@2x.png',
                  width: 20,
                  height: 20,
                ),
                Text(
                  '联系卖家',
                  style: TextStyle(
                    color: Colors.black54,
                    fontSize: 12,
                  ),
                ),
              ],
            ),
          ),

          SizedBox(
            width: MediaQuery.of(context).size.width/3/2+15,
            height: 40,
            child: TextButton(
              onPressed: (){
                Navigator.of(context).push(MaterialPageRoute(builder: (_) {
                  return StoreShopPage();
                }));
              },
              child: Column(
                children: [
                  Image.asset(
                    'assets/images/common/product_store@2x.png',
                    width: 20,
                    height: 20,
                  ),
                  Text(
                    '店铺',
                    style: TextStyle(
                      color: Colors.black54,
                      fontSize: 12,
                    ),
                  ),
                ],
              ),
            ),
          ),

          SizedBox(
            width: MediaQuery.of(context).size.width/3-20,
            height: 40,
            child: TextButton(
              onPressed: () {
                Provider.of<StoreCountModel>(context,listen: false).add(widget.model);
              },
              child: Text(
                '加入购物车',
                style: TextStyle(
                  color: Colors.black,
                  fontSize: 13,
                  fontWeight: FontWeight.bold,
                ),
              ),
              // color: AppColors.yellow,
              // shape: RoundedRectangleBorder(
              //     side: BorderSide(
              //       color: AppColors.yellow,
              //       width: 0.5,
              //     ),
              //     borderRadius: BorderRadius.circular(20)),
            ),
          ),
          SizedBox(width: 10,),
          SizedBox(
            width: MediaQuery.of(context).size.width/3-30,
            height: 40,
            child: TextButton(
              onPressed: () => print(''),
              child: Text(
                '立即购买',
                style: TextStyle(
                  color: Colors.black,
                  fontSize: 14,
                  fontWeight: FontWeight.bold,
                ),
              ),
              // color: AppColors.yellow,
              // shape: RoundedRectangleBorder(
              //     side: BorderSide(
              //       color: AppColors.yellow,
              //       width: 0.5,
              //     ),
              //     borderRadius: BorderRadius.circular(20)),
            ),
          )
        ],
      ),
    );
  }
}
